package com.itheima.controller;

import com.itheima.dto.EmpLoginDto;
import com.itheima.pojo.Emp;
import com.itheima.pojo.Result;
import com.itheima.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping
public class LoginController {

    @Autowired
    private EmpService empService;
    @PostMapping("/login")
    public Result login(@RequestBody EmpLoginDto loginDto){
        //成功就返回令牌，不成功返回null,给前端返回 NOT_LOGIN

        return empService.login(loginDto);
    }
}
